"""
正则表达式模板集合
提供常用的正则表达式模板供用户选择
"""

TEMPLATES = {
    "电子邮件": {
        "pattern": r"[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+",
        "description": "匹配标准电子邮件地址",
        "example": "user@example.com, name.surname+tag@domain.co.uk"
    },
    "中国手机号": {
        "pattern": r"1[3-9]\d{9}",
        "description": "匹配中国大陆手机号码",
        "example": "13812345678, 15912345678"
    },
    "网址URL": {
        "pattern": r"https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+[/\w\.-]*(?:\?\S+)?",
        "description": "匹配HTTP或HTTPS URL",
        "example": "http://example.com, https://site.com/path?query=123"
    },
    "IP地址": {
        "pattern": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
        "description": "匹配IPv4地址",
        "example": "192.168.1.1, 10.0.0.1"
    },
    "中国身份证号": {
        "pattern": r"\d{17}[\dXx]|\d{15}",
        "description": "匹配15位或18位身份证号码",
        "example": "110101199001011234, 11010119900101123X"
    },
    "日期(YYYY-MM-DD)": {
        "pattern": r"\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])",
        "description": "匹配YYYY-MM-DD格式日期",
        "example": "2023-01-28, 2025-12-31"
    },
    "时间(HH:MM:SS)": {
        "pattern": r"(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d",
        "description": "匹配24小时制时间",
        "example": "09:30:45, 23:59:59"
    },
    "HTML标签": {
        "pattern": r"<[^>]+>",
        "description": "匹配任意HTML标签",
        "example": "<div>, <a href='#'>链接</a>"
    },
    "中文字符": {
        "pattern": r"[\u4e00-\u9fa5]+",
        "description": "匹配中文字符",
        "example": "你好，世界"
    },
    "数字": {
        "pattern": r"[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?",
        "description": "匹配整数、小数和科学计数法",
        "example": "123, -45.67, 1.23e+4"
    }
} 